package ch.unisi.inf.java.project.riskbami.model;

/**
 * PassCommand is an extension of GenericCommand.
 * Provide the implementation of a commands that is responsible to pass
 * the turn.
 * 
 * @author minellir@lu.unisi.ch
 * @author babazadm@lu.unisi.ch
 */
public final class PassCommand extends GenericCommand
{
    private final Game game;
    
    /**
     * The contructor for the class PassCommand
     * 
     * @param game The actual game
     */
    public PassCommand(final Game game) {
        super(game);
        this.game = game;
    }

    /**
     * canExecute verify whether we can execute this method.
     * Actually you can always execute the Pass.
     * 
     * @return boolean
     */
    public boolean canExecute() {
        if(game.getTurnPhase() != 1){
            return true;
        } else return false;
    }
    
    /**
     * execute is responsible to execute the given PassCommand command.
     */
    public void execute(){
        game.setPhaseZero();
        game.getCurrentPlayer().setCanDraw(true);
        game.switchNextPlayer();
    }
}